﻿using Microsoft.Extensions.DependencyInjection;
using System;

namespace YDT.Payment.Application
{
    /// <summary>
    /// WebPagePay 支付ServiceCollection扩展
    /// </summary>
   public static class WebPagePayServiceCollectionExtensions
    {
        /// <summary>
        /// 注册WebPage支付
        /// </summary>
        /// <param name="services"></param>
        /// <returns></returns>
        public static IServiceCollection AddWebPagePay(this IServiceCollection services)
        {
            services.AddSingleton<WxPayHttpClient>();// 微信调用封装
            services.AddHttpClient();
            services.AddSingleton<IWebPagePay, AliPagePay>();// 支付宝封装类注册
            services.AddSingleton<IWebPagePay, WxNativePay>();// 微信支付封装
            services.AddSingleton<WebPagePayFactory>();// 支付选择工厂注册
            services.AddSingleton<WebPagePayFacade>(); // 统一支付外观
            return services;
        }
    }
}
